import request from "@/utils/request"

const ORDER_BASE_URL = "/api";

const OrderAPI = {
  getPage(queryParams: orderPageQuery) {
    return request<any, PageResult<[]>>({
      url: `${ORDER_BASE_URL}/sales/supplier/`,
      method: "get",
      params: queryParams,
    });
  },
  getSalesSupplier(id: Number) {
    return request({
      url: `${ORDER_BASE_URL}/sales/supplier/${id}/`,
      method: "get"
    });
  },
  getExpressCompanies(data: expressPageQuery) {
    return request<any, PageResult<[]>>({
      url: `${ORDER_BASE_URL}/express/companies/`,
      method: "get"
    });
  },
  orderSalesExpress(id: Number, data: Object) {
    return request<any, PageResult<[]>>({
      url: `${ORDER_BASE_URL}/sales/supplier/${id}/express/`,
      method: "post",
      data: data
    });
  },
  getSalesServicesSupplier(data: Object) {
    return request<any, PageResult<[]>>({
      url: `${ORDER_BASE_URL}/sales/services/supplier/`,
      method: "get",
      params: data
    });
  },
  getSalesServicesSupplierInfo(id: number) {
    return request<any, PageResult<[]>>({
      url: `${ORDER_BASE_URL}/sales/services/${id}/supplier/`,
      method: "get"
    });
  }
}

export default OrderAPI;

export interface expressPageQuery {
  search: string
}

export interface orderPageQuery {
  status?: string; //订单状态：待处理：draft 已发货：express 已取消：canceled
  merchant?: number;
  search?: string;
  page?: number;
  size?: number;
}
